export interface AIBattleResult {
  id: string;
  playerId: string;
  opponentId: string;
  battleType: 'solo' | 'team' | 'pvp';
  isAI: boolean;
  score: number;
  opponentScore: number;
  result: 'victory' | 'defeat' | 'draw';
  rounds: number;
  correctAnswers: number;
  totalAnswers: number;
  averageReactionTime?: number;
  battleDate: Date;
  season: string;
  rankPoints: number;
  teamId?: string;
  teamScore?: number;
  teamOpponentScore?: number;
  roomId?: string;
  spectators?: number;
}

export interface AIBattleSeason {
  id: string;
  name: string;
  startDate: Date;
  endDate: Date;
  isActive: boolean;
  rewards: SeasonReward[];
}

export interface SeasonReward {
  rank: number;
  title: string;
  badge: string;
  points: number;
}

export interface PlayerRank {
  playerId: string;
  playerName: string;
  rank: number;
  rankPoints: number;
  wins: number;
  losses: number;
  draws: number;
  winRate: number;
  totalBattles: number;
  currentStreak: number;
  bestStreak: number;
  averageScore: number;
  season: string;
  title?: string;
  badge?: string;
}

export interface BattleTeam {
  id: string;
  name: string;
  playerIds: string[];
  wins: number;
  losses: number;
  draws: number;
  rankPoints: number;
  createdDate: Date;
  captainId: string;
}

export interface TeamBattleChallenge {
  id: number;
  type: 'reaction' | 'memory' | 'math' | 'pattern' | 'color' | 'coordination';
  question: string;
  options?: string[];
  correctAnswer: string | number;
  timeLimit: number;
  difficulty: 'easy' | 'medium' | 'hard';
  points: number;
}

export interface TeamBattleStats {
  playerTeamScore: number;
  aiTeamScore: number;
  round: number;
  totalRounds: number;
  timeRemaining: number;
  playerTeamCorrect: number;
  aiTeamCorrect: number;
  currentPlayerIndex: number;
  completedChallenges: number[];
}

// 真人对战相关类型
export interface PvPPlayer {
  id: string;
  name: string;
  avatar: string;
  level: number;
  rank: number;
  rankPoints: number;
  winRate: number;
  isOnline: boolean;
  status: 'idle' | 'searching' | 'in-game' | 'spectating';
  currentStreak: number;
  title?: string;
  badge?: string;
}

export interface BattleRoom {
  id: string;
  name: string;
  mode: 'ranked' | 'casual' | 'tournament' | 'private';
  maxPlayers: number;
  currentPlayers: number;
  players: PvPPlayer[];
  spectators: PvPPlayer[];
  status: 'waiting' | 'ready' | 'in-progress' | 'finished';
  settings: RoomSettings;
  createdBy: string;
  createdAt: Date;
  password?: string;
  isPrivate: boolean;
}

export interface RoomSettings {
  rounds: number;
  timePerRound: number;
  difficulty: 'easy' | 'medium' | 'hard' | 'mixed';
  categories: string[];
  allowSpectators: boolean;
  maxSpectators: number;
  chatEnabled: boolean;
  voiceChatEnabled: boolean;
}

export interface MatchmakingQueue {
  playerId: string;
  mode: 'ranked' | 'casual';
  preferredDifficulty: 'easy' | 'medium' | 'hard' | 'mixed';
  queueTime: number;
  estimatedWaitTime: number;
  rankRange: [number, number];
}

export interface ChatMessage {
  id: string;
  senderId: string;
  senderName: string;
  message: string;
  timestamp: Date;
  type: 'text' | 'system' | 'emote' | 'voice';
  roomId?: string;
  isGlobal?: boolean;
}

export interface Friend {
  id: string;
  name: string;
  avatar: string;
  level: number;
  isOnline: boolean;
  status: string;
  addedDate: Date;
  lastSeen?: Date;
  mutualFriends?: number;
}

export interface PvPBattleStats {
  player1Score: number;
  player2Score: number;
  player1Correct: number;
  player2Correct: number;
  round: number;
  totalRounds: number;
  timeRemaining: number;
  currentQuestion: number;
  player1Answer?: string | number;
  player2Answer?: string | number;
  player1Time?: number;
  player2Time?: number;
}